
#!/bin/bash

MODULE='percpu'

MODULE_STATUS=`lsmod | grep ${MODULE}`
[ "${MODULE_STATUS}" != "" ] && sudo rmmod ${MODULE}


echo nop > /sys/kernel/debug/tracing/trace

echo function > /sys/kernel/debug/tracing/current_tracer
echo pcpu_alloc > /sys/kernel/debug/tracing/set_ftrace_filter

echo 1 > /sys/kernel/debug/tracing/tracing_on
sudo insmod ${MODULE}.ko
echo 0 > /sys/kernel/debug/tracing/tracing_on

cat /sys/kernel/debug/tracing/trace
sudo rmmod ${MODULE}


